#!user/bin/env python3
# -- coding: utf-8 --
# @Createtime：2023/9/10
# @Updatetime：10:51
# @Author：Test008
# @File：12-类型注解1.py
# @Description：
# 基础数据类型注解：
import datetime
import json
import random
from typing import List

# var_1: int = 10
# var_2: str = "张三"
# var_3: bool = True


# 类对象进行注解：
# class Student:
#     pass


# stu: Student = Student()

# 基础容器类型注解
# my_list: list = [1, 2, 3]
# my_tuple: tuple = (1, 2, 3)
# my_dict: dict = {"name": "bobby"}
# 容器类型的详细注解：python3.8不支持此功能
# my_list1: list[int] = [1, 2, 3]
# my_tuple1: tuple[int] = (1, 2, 3)
# my_dict1: dict[str:int] = {"name": "bobby"}
# 在注释中进行类型注解
# list1 = [1, 2, 3]  # type:list[int]
# tuple1 = (1, 23, 3)  # type:tuple[int]
# let_rangdom = random.randint(1, 10)  # type:int
# let_json = json.loads('{"name":"张三"}')  # type:dict[str,str]


# def func():
#     return 10


# var1 = func()  # type:int
# 类型注解的限制 类型注解只是提示作用，不会影响代码运行
# let1: int = "张三"
# let: str = 10

var1: int = 1
var2: str = "abby"
var3: bool = True


class Student:
    pass


stu: object = Student()

my_list: list = [1, 2, 3]
my_tuple: tuple = (1, 2, 3)
my_dict: dict = {"age": 11}

my_list1: list[int] = [1, 2, 3]
my_tuple1: tuple[int, str, bool] = (1, "abby", False)
my_dict1: dict[str, int] = {"age": 11}

var_1 = random.randint(1, 10)  # type:int
var_2 = json.loads('{"age":11}')  # type:dict[str,int]


def func():
    return 10


var_3 = func()  # type:int
